home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
parallel
/
descript.c
< prev
next >
Wrap
Text File
|
1992-04-11
|
2KB
|
49 lines
/*-------------------------------------------------------------------*/
/*----Upgrade to predio.c in muProlog to get access to file */
/*----descriptors associated with channels. Needs additions to init.c*/
/*----and init.h : */
/*----init.c - fassert(find(3,"descriptor"),(Ptr) p_descriptor,-1,0);*/
/*----init.h - ,p_descriptor() */
/*---- */
/*----Needs stdio.h */
/*---- */
/*----Usage :-descriptor(+Channel,-Descriptor). */
/*---- */
/*----Written by Geoff Sutcliffe 7/12/89 */
/*-------------------------------------------------------------------*/
p_descriptor(t,l)
Ptr t;
levtype l;
{
Ptr t_channel;
levtype l_channel;
int channel_number;
findbind((Ptr)targ(1,t),l,&t_channel,&l_channel);
if (ttype(t_channel) != TNUM)
{
plerror(EEINT);
return(ERROR);
}
findbind((Ptr)targ(2,t),l,&t,&l);
if(ttype(t) != TVAR)
{
plerror(EEVAR);
return(ERROR);
}
channel_number = tnum(t_channel);
if (channel_number < 0 || channel_number >= MAXFILES+MAXDBQ ||
!pfiles[channel_number])
{
plerror(EFILE);
return(ERROR);
}
nbind(t,l,ConsInt(fileno(pfiles[channel_number])));
return(SUCCEED);
}
/*-------------------------------------------------------------------*/